package com.gwtgeo.ui.client.mvp;

import net.customware.gwt.dispatch.client.DispatchAsync;

import com.google.gwt.user.client.ui.HasWidgets;
import com.google.inject.Inject;
import com.gwtgeo.ui.client.mvp.desktop.DesktopPresenter;
import com.gwtgeo.ui.client.mvp.windowsmanager.WindowsManager;

public class AppPresenter {

	private DesktopPresenter desktop;

	@Inject
	public AppPresenter(final DispatchAsync dispatcher,
			final DesktopPresenter desktop, final WindowsManager windowsManager) {
		super();
		this.desktop = desktop;
		windowsManager.setContainer(desktop.getDisplay().getWorkArea());
		windowsManager.bind();
		this.desktop.registerViews();
		this.desktop.bind();
	}

	public void go(HasWidgets container) {
		container.clear();
		container.add(desktop.getDisplay().asWidget());

	}
}